Ext
		.define(
				'com.hh.workflow.properties.UserTask',
				{
					extend : 'com.hh.global.SimpleFormPanelWindow',
					title : '任务属性',
					width : 600,
					constructor : function(config) {
						this.config = config || {};
						this.superclass.constructor.call(this, this.config);

						var page = this;
						var hrefField = this.form.getForm().findField('href');
						var hrefParamsField = this.form.getForm().findField(
								'hrefParams');
						if (hrefField.getValue() == null
								|| hrefField.getValue() == '') {
							hrefField.setValue(this.rootobject.href);
						}
						if (hrefParamsField.getValue() == null
								|| hrefParamsField.getValue() == ''
								|| hrefParamsField.getValue() == {}
								|| hrefParamsField.getValue() == '{}') {
							hrefParamsField
									.setValue(this.rootobject.hrefParams);
						}

						if (hrefParamsField.getValue() != null
								&& hrefParamsField.getValue() != ''
								&& hrefParamsField.getValue() != {}
								&& hrefParamsField.getValue() != '{}') {
							var formDataId = Ext.decode(hrefParamsField
									.getValue()).formDataId;
							page.setFormManagerValue(formDataId);
						}
					},
					setFormManagerValue : function(formDataId) {
						var page = this;
						if (formDataId) {
							Request.request(
									"form-FormWidget-findObjectByDataId", {
										dataId : formDataId
									}, function(result) {
										page.updateFormManagerValue(result);
									});
						}
					},
					updateFormManagerValue : function(result) {
						var page = this;
						var formManagerField = page.form.getForm().findField(
								'formManager');
						var formManagerObject = {};
						if (formManagerField.getValue()) {
							formManagerObject = Ext.decode(
									formManagerField.getValue()).toObject(
									'name');
						}
						var formSource = result.formSource;
						var dataList = [];
						if (formSource != null) {
							formSource = Ext.decode(formSource);
							for ( var i = 0; i < formSource.length; i++) {
								var data = formManagerObject[formSource[i].name];
								if (data == null) {
									data = {};
								}
								Ext.apply(data, {
									text : formSource[i].fieldLabel,
									name : formSource[i].name
								});
								dataList.push(data);
							}
							formManagerField.setValue(dataList);
						}
					},
					getFormItems : function() {
						var page = this;
						return [
								{
									fieldLabel : 'type',
									name : 'type',
									hidden : true,
									columnWidth : 0.5
								},
								{
									fieldLabel : 'ID',
									name : 'id',
									columnWidth : 0.5,
									readOnly : true
								},
								{
									fieldLabel : '名称',
									name : 'label',
									allowBlank : false,
									columnWidth : 0.5
								},
								{
									fieldLabel : '隐藏附件',
									xtype : 'checkbox',
									name : 'attachment',
									columnWidth : 0.5
								},
								{
									fieldLabel : '隐藏意见',
									xtype : 'checkbox',
									name : 'comment',
									columnWidth : 0.5
								},
								{
									"xtype" : "widgetComboBoxTree",
									"name" : "href",
									"fieldLabel" : "表单",
									"allowBlank" : false,
									editable : true,
									submitType : 'text',
									"action" : "system-GlobalComboBoxTree-queryTree",
									"extraParams" : "{'table_name':'hh_xt_data','type':'form_tree'}",
									"paramType" : "paramsMap",
									columnWidth : 1,
									afitemclick : function(view, record) {
										this
												.setValue("com.hh.workflow.form.WorkFlowPageEdit");
										this.nextSibling().varGridStore
												.remove(this.nextSibling().varGridStore
														.findRecord('key',
																'formDataId'));
										this.nextSibling().varGridStore.add({
											"key" : 'formDataId',
											"value" : record.get("id")
										});
										page.setFormManagerValue(record
												.get("id"));
									}
								},
								{
									fieldLabel : '表单参数',
									xtype : 'widgetPropertiesField',
									columnWidth : 1,
									name : 'hrefParams'
								},
								{
									fieldLabel : '表单控制',
									xtype : 'widgetGridField',
									columnWidth : 1,
									name : 'formManager',
									getFields : function() {
										return [ 'text', 'name', 'readOnly',
												'hidden' ];
									},
									getColumns : function() {
										return [ {
											header : '字段名',
											dataIndex : 'text',
											flex : 1
										}, {
											header : '名称',
											dataIndex : 'name',
											flex : 1
										}, {
											header : '只读',
											xtype : 'checkcolumn',
											dataIndex : 'readOnly',
											width : 40
										}, {
											header : '隐藏',
											xtype : 'checkcolumn',
											dataIndex : 'hidden',
											width : 40
										} ];
									},
									getTbar : function() {
										return null;
									}
								},
								{
									name : 'users',
									xtype : 'widgetUserSelect',
									fieldLabel : '候选用户'
								},
								{
									name : 'orgs',
									xtype : 'widgetOrgSelect',
									fieldLabel : '组织机构',
									columnWidth : 0.8
								},
								{
									fieldLabel : '隐藏',
									xtype : 'checkbox',
									name : 'isorg',
									columnWidth : 0.2,
									labelWidth : 40
								},
								{
									allowBlank : true,
									multiSelect : true,
									xtype : 'widgetComboBox',
									fieldLabel : '候选角色',
									name : 'roles',
									action : 'usersystem-role-queryAllRoleList',
									columnWidth : 0.8
								}, {
									fieldLabel : '隐藏',
									xtype : 'checkbox',
									name : 'isrole',
									columnWidth : 0.2,
									labelWidth : 40
								} ];
					}
				});